package com.wkhyapp.lm.contract;

import com.wkhyapp.lm.base.BasePresenter;
import com.wkhyapp.lm.http.ApiCallback;
import com.wkhyapp.lm.http.net.BaseRequest;
import com.wkhyapp.lm.http.net.SuperResponse;
import com.wkhyapp.lm.http.vo.Category;
import com.wkhyapp.lm.http.vo.Member;
import com.wkhyapp.lm.utils.MemberUtils;

/**
 * Created by Administrator on 2021-10-6.
 */

public class SearchPresenter extends BasePresenter<SearchView> {

    public SearchPresenter(SearchView searchView) {
        super(searchView);
    }

    public void getData(){
        BaseRequest request = new BaseRequest();
        addSubscription(apiStores.popularityRanking(request),new ApiCallback<SuperResponse<Member>>() {
            @Override
            public void onSuccess(SuperResponse<Member> response) {
                mvpView.setHostMember(response.getItems());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });
    }

    public void  getToken(){
        BaseRequest request = new BaseRequest();
       // request.setUserId(MemberUtils.getUid());
        addSubscription(apiStores.getUploadToken(request),new ApiCallback<SuperResponse<String>>() {
            @Override
            public void onSuccess(SuperResponse<String> response) {
                mvpView.setToken(response.getItem());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
            }
        });
    }
}
